cmake_minimum_required(VERSION 2.8.3)
project(offboard)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_definitions(-std=c++11 -g -O1 -ftree-vectorize -march=native)

find_package(catkin REQUIRED COMPONENTS
    ## Newly added
    mavros
    rosbag
    
    roscpp
    rospy
    roslib
    tf
    std_msgs
    sensor_msgs
    geometry_msgs
    mavros_msgs
    visualization_msgs
    trajectory_msgs
    nav_msgs
    message_generation
)

find_package(Eigen3 REQUIRED)

 add_message_files(
    FILES
    PosVelAcc.msg
 )

generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
)

catkin_package(
    CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
)

include_directories(${catkin_INCLUDE_DIRS})
include_directories(${EIGEN3_INCLUDE_DIRS})

add_definitions(${EIGEN_DEFINITIONS})

## Newly added
link_directories(lib/x86-64_linux/static_pic)
add_definitions(-DIL_STD)
add_definitions(-DCPX_FORCE_DEPRECATION_WARNINGS)

include_directories(
        ../../devel/include/offboard/
        ${PROJECT_SOURCE_DIR}/include
)

file(GLOB HGJPathSmoothFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
        include/HGJPathSmooth/*.cpp include/HGJPathSmooth/*.h)

add_executable(controller_node src/controller_node.cpp)
target_link_libraries(controller_node ${catkin_LIBRARIES})
#target_link_libraries(controller PosVelAcc)

# DEMO
add_executable(posctl_hover src/posctl_hover.cpp)
target_link_libraries(posctl_hover ${catkin_LIBRARIES})

add_executable(posctl_circle src/posctl_circle.cpp)
target_link_libraries(posctl_circle ${catkin_LIBRARIES})

add_executable(attctl_circle src/attctl_circle.cpp)
target_link_libraries(attctl_circle ${catkin_LIBRARIES})
# target_link_libraries(attctl_circle PosVelAcc)

## Newly Added
# add_executable(pathpoint_lx src/pathpoint_lx.cpp)
# target_link_libraries(pathpoint_lx ${catkin_LIBRARIES})
# add_library(HGJ_Path_Smooth ${HGJPathSmoothFILES})
# target_link_libraries(pathpoint_lx ilocplex cplex concert m pthread dl HGJ_Path_Smooth)

## second addition 
#add_executable(pathpoint_lx src/pathpoint_lx.cpp)
#target_link_libraries(pathpoint_lx ${catkin_LIBRARIES} ilocplex cplex concert m pthread dl HGJ_Path_Smooth)
#target_link_libraries(pathpoint_lx PosVelAcc)


add_executable(attctl_traj src/attctl_traj.cpp)
add_dependencies(attctl_traj  ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} )
target_link_libraries(attctl_traj ${catkin_LIBRARIES} )
